;
(function () {
	var num = 0
	var g_data=[];
	$(function () {
		$(".option li").click(function(){
    		$(".option li").eq($(this).index()).addClass("sel").siblings().removeClass("sel");
     	});


		var hash = location.hash;
		hash = hash.substr(1);
		var rt = 'http://cs.nksoft.cn/index.php/api';

		$.getJSON(rt+'/class/test/?'+hash,function(response){
			var data=response.data;
			
			//console.log(data);
			for(var i=0;i<data.length;i++){
				var op=data[i].content;
				 data[i].content=JSON.parse(op);
				 //console.log(op)
			}

			g_data = data;
			g_data[num]['num'] = num;

			var gettpl = document.getElementById('demo').innerHTML;
			laytpl(gettpl).render(g_data[num], function(html){
  				document.getElementById('container').innerHTML = html;
			});
			num++;
		})
		





     	$(".next").click(function(){
     		g_data['num'] = num;
		var gettpl = document.getElementById('demo').innerHTML;
		laytpl(gettpl).render(g_data[num], function(html){
			document.getElementById('container').innerHTML = html;
		});
		num++;
	})

	
	});
})();





 
	
